DIR = $(SRC_CLIENT_DIR)
LIBS = $(CLIBS) -ltools -lnetwork 
FILES := $(foreach dir,$(DIR),$(wildcard $(dir)/*.c))
FILENDIR := $(notdir $(FILES))
OBJS = $(patsubst %,$(BUILD_DIR)/%,$(patsubst %c,%o, $(FILENDIR)))
TARGET = $(patsubst %main.c,%,$(notdir $(foreach dir, $(DIR), $(wildcard $(dir)/*main.c))))

$(BIN_DIR)/$(TARGET): $(OBJS)
	$(CC) $(FLAGS) -o $@ $^ $(LIBS)

$(OBJS): $(BUILD_DIR)/%.o: %.c
	$(CC) $(FLAGS) $(INCLUDE) -c -o $@ $^